Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract package fetching logic into shared utility #130

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

g-elwell
Copy link
Member

Description

This PR extracts the logic for fetching and validating packages into a shared utility which can be used by any commands.

Previously this was implemented in two locations, with more on the way in #101 and #119. Repeating this logic is complicated and prone to errors due to the various scenarios and validation required to gather a list of build-tools-compatible packages to run a command against.

This change fixes a potential bug where the ci and install commands would try to run against unexpected packages (e.g: plugins with a package.json but no src/entrypoints). I am unsure whether this was intentional, as although an entrypoint is not required to run npm install, we enforce the entrypoint directory structure in our projects and use this to differentiate them from other packages that may exist in a workspace. I don't think the build tools should be concerned with packages that don't meet this criteria as the results could be unexpected.

Before

61863

After

12777

@g-elwell g-elwell self-assigned this Jan 20, 2025
@g-elwell g-elwell added the bug Something isn't working label Jan 20, 2025
@g-elwell g-elwell force-pushed the fix/extract-package-fetching branch from fc8702c to 385bbb5 Compare January 20, 2025 10:14
@g-elwell g-elwell marked this pull request as ready for review January 20, 2025 10:15
@g-elwell g-elwell requested a review from ampersarnie as a code owner January 20, 2025 10:15
@g-elwell g-elwell marked this pull request as draft January 20, 2025 14:34
@g-elwell

This comment was marked as resolved.

@ampersarnie
Copy link
Member

ampersarnie commented Jan 20, 2025

Previously this was implemented in two locations, with more on the way in #101 and #119.

We can ignore #119 for the time being, and I'm unsure of when or if #101 will be added - a lot has changed since.

This change fixes a potential bug where the ci and install commands would try to run against unexpected packages (e.g: plugins with a package.json but no src/entrypoints). I am unsure whether this was intentional.

This wasn't intentional and the behaviour you're trying to get here is what is needed, so the ideas and direction work. Code just needs reviewing and testing.

@g-elwell g-elwell force-pushed the fix/extract-package-fetching branch from 385bbb5 to 248127d Compare January 20, 2025 21:04
@g-elwell g-elwell marked this pull request as ready for review January 20, 2025 21:06
@g-elwell
Copy link
Member Author

@ampersarnie this is now ready, thanks! I think there's potential to improve it in future, but I've purposefully left the extracted utility as close as possible as it was in the build script for ease of review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants